package com.xuecheng.content.controller;

import com.xuecheng.commons.model.dto.BindTeachplanMediaDto;
import com.xuecheng.commons.model.vo.ResponseResult;
import org.springframework.web.bind.annotation.*;
import com.xuecheng.content.service.TeachplanMediaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author itheima
 */
@Slf4j
@RestController
public class TeachplanMediaController {

    @Autowired
    private TeachplanMediaService teachplanMediaService;

    // 媒资绑定
    @PostMapping("/teachplan/media/association")
    public ResponseResult association(@RequestBody BindTeachplanMediaDto dto) {
        return teachplanMediaService.association(dto);
    }

   /* //根据课程id查询所有绑定媒资信息
    @GetMapping("/teachpian/media/{courseId}")
    public ResponseResult teachplanMedia(@PathVariable("courseId") Long courseId){
        return teachplanMediaService.teachplanMedia(courseId);
    }*/

    //课程计划[3级小节] 解绑媒资
    @DeleteMapping("/teachplan/media/{teachPlanMediaId}")       //中间表id     课程id
    public ResponseResult delete(@PathVariable("teachPlanMediaId") Long teachPlanMediaId, Long courseBaseId) {
        //另外一个参数????课程id    判断课程是否发布>>>>>>>   暂时不知道怎么接收参数

        return teachplanMediaService.delete(teachPlanMediaId, courseBaseId);
    }

}
